package com.quanyan.place.entity;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by yuanxuebing on 16/12/15.
 */
public class PromoteStatInfo implements Serializable {
    // 总记录数
    private Integer totalRecordCount;

    // 总短信数
    private Integer totalSMSCount;

    // 总下单记录数
    private Integer totalOrderCount;

    // 总完成订单数
    private Integer totalFinishedOrderCount;

    // 总奖励金额
    private BigDecimal totalRewardAmount;

    public Integer getTotalRecordCount() {
        return totalRecordCount;
    }

    public void setTotalRecordCount(Integer totalRecordCount) {
        this.totalRecordCount = totalRecordCount;
    }

    public Integer getTotalSMSCount() {
        return totalSMSCount;
    }

    public void setTotalSMSCount(Integer totalSMSCount) {
        this.totalSMSCount = totalSMSCount;
    }

    public Integer getTotalOrderCount() {
        return totalOrderCount;
    }

    public void setTotalOrderCount(Integer totalOrderCount) {
        this.totalOrderCount = totalOrderCount;
    }

    public Integer getTotalFinishedOrderCount() {
        return totalFinishedOrderCount;
    }

    public void setTotalFinishedOrderCount(Integer totalFinishedOrderCount) {
        this.totalFinishedOrderCount = totalFinishedOrderCount;
    }

    public BigDecimal getTotalRewardAmount() {
        return totalRewardAmount;
    }

    public void setTotalRewardAmount(BigDecimal totalRewardAmount) {
        this.totalRewardAmount = totalRewardAmount;
    }

    /*
     SQL可能出现这样的情况
     "statInfo": {
          "totalSMSCount": 0,
          "totalOrderCount": null,
          "totalFinishedOrderCount": null,
          "totalRewardAmount": null
        }
     */
    public void fix() {
        if (totalSMSCount == null) {
            totalSMSCount = 0;
        }

        if (totalOrderCount == null) {
            totalOrderCount = 0;
        }

        if (totalFinishedOrderCount == null) {
            totalFinishedOrderCount = 0;
        }

        if (totalRewardAmount == null) {
            totalRewardAmount = BigDecimal.ZERO;
        }
    }
}
